package com.kede.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kede.ienum.store.UserStoreStatusEnum;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 用户到门店消费物资记录表
 * @TableName t_store_user_order
 */
@TableName(value ="t_store_user_order")
@Data
public class StoreUserOrderDomain implements Serializable {
    /**
     * 
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 门店id
     */
    @TableField(value = "store_id")
    @NotNull
    private Integer storeId;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    @NotNull
    private Integer userId;

    /**
     * 消费数量
     */
    @TableField(value = "num")
    @NotNull
    private Integer num;

    /**
     * 物资id
     */
    @TableField(value = "supplie_id")
    @NotNull
    private Integer supplieId;

    /**
     * 状态：1 门店待确认 2 待领取 3 已完成
     */
    @TableField(value = "status")
    private UserStoreStatusEnum status;

    /**
     * 
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 德币
     */
    @TableField(value = "debi")
    private BigDecimal debi;

    /**
     * RMB
     */
    @TableField(value = "money")
    private BigDecimal money;

    /**
     * 门店是否删除 1是 0否
     */
    @TableField(value = "storeisdel")
    private Integer storeIsdel;

    /**
     * 用户是否删除 1是 0否
     */
    @TableField(value = "userisdel")
    private Integer userIsdel;


    /**
     * 领取码
     */
    @TableField(value = "code")
    private Integer code;

    /**
     * 领取凭证
     */
    @TableField(value = "imgs")
    private String imgs;


    /**
     * 门店信息
     */
    @TableField(exist = false)
    private ZhiUserCertifiedDomain store;

    /**
     * 物资商品信息
     */
    @TableField(exist = false)
    private SuppliesDomain supplie;

    /**
     * 用户信息
     */
    @TableField(exist = false)
    private UsersDomain user;


    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        StoreUserOrderDomain other = (StoreUserOrderDomain) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum()))
            && (this.getSupplieId() == null ? other.getSupplieId() == null : this.getSupplieId().equals(other.getSupplieId()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode());
        result = prime * result + ((getSupplieId() == null) ? 0 : getSupplieId().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", storeId=").append(storeId);
        sb.append(", userId=").append(userId);
        sb.append(", num=").append(num);
        sb.append(", supplieId=").append(supplieId);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}